// Sorting.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
#include "LinkedList.h"
#include <fstream>
#include <time.h>

long linkedCompletionTime;
clock_t linkedBeginTime;
clock_t linkedEndTime;
void populateLinkedList(LinkedList<unsigned short int>* listToPopulate);

int _tmain(int argc, _TCHAR* argv[])
{
	LinkedList<unsigned short int>* testList = LinkedList<unsigned short int>::newLinkedList();


	populateLinkedList(testList);

	linkedBeginTime = clock();
	testList->sort();
	linkedEndTime = clock();

	cout << "\n\n\n" << testList->toString() << endl;



	cout << "Sort Time " << (linkedEndTime - linkedBeginTime);


	delete testList;

	return 0;
}

void populateLinkedList(LinkedList<unsigned short int>* listToPopulate)
{
	int numberRead;

	ifstream dataFile;
	dataFile.open("input.txt");


	if (dataFile.is_open())
	{
		while (dataFile >> numberRead)
		{
			listToPopulate->addToHead(numberRead);
		}
	}
	else
	{
		cout << "Could Not Find Information Text File";
	}
}
